<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('服务对象信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="vtsp:recipient:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="vtsp:recipient:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="vtsp:recipient:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:user:import">
                    <i class="fa fa-upload"></i> 导入
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="vtsp:recipient:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table">
                    <thead>
                        <tr>
                            <th data-checkbox="true"></th>
                            <th data-formatter="fm_rowIndex" data-align="center">序号</th>
                            <th data-field="recipientCnname">服务对象中文名</th>
                            <th data-field="recipientEnname">服务对象英文名</th>
                            <th data-field="recipientSex" data-formatter="fm_recipient_sex">性别</th>
                            <th data-field="countryName">国籍名称</th>
                            <th data-field="passportNum">护照号</th>
                            <th data-field="recipientBirthday">生日</th>
                            <th data-field="isBandleader" data-formatter="fm_is_bandleader">是否是领队</th>
                            <th data-field="createTime">创建时间</th>
                            <th data-field="recipientState" data-formatter="fm_recipient_state">状态</th>
                            <th data-formatter="fm_commands" data-width="120px" data-align="center">操作</th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('vtsp:recipient:edit')}]];
        var removeFlag = [[${@permission.hasPermi('vtsp:recipient:remove')}]];
        var prefix = ctx + "vtsp/recipient";

        $(function() {
            var options = {
                url: prefix + "/listById/" + [[${activityId}]],
                createUrl: prefix + "/add/[[${activityId}]]",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                importUrl: prefix + "/importList",
                importTemplateUrl: prefix + "/importTemplate",
                modalName: "服务对象信息",
                uniqueId: "recipientId"
            };
            $.table.init(options);
        });

        //  是否领队字典数据
        let is_bandleader_dict = [[${@dict.getType('is_bandleader')}]];
        //  根据字典的格式转化器
        function fm_is_bandleader(value, row ,index) {
            return $.table.selectDictLabel(is_bandleader_dict, value);
        }

        //  服务对象性别字典数据
        let recipient_sex_dict = [[${@dict.getType('recipient_sex')}]];
        //  根据字典的格式转化器
        function fm_recipient_sex(value, row ,index) {
            return $.table.selectDictLabel(recipient_sex_dict, value);
        }

        //  服务对象状态字典数据
        let recipient_state_dict = [[${@dict.getType('recipient_state')}]];
        //  根据字典的格式转化器
        function fm_recipient_state(value, row ,index) {
            return $.table.selectDictLabel(recipient_state_dict, value);
        }

        //命令
        function fm_commands(value, row, index){
            var actions = [];
            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.recipientId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.recipientId + '\')"><i class="fa fa-remove"></i>删除</a>');
            return actions.join('');
        }
    </script>
</body>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                &nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>
